package cn.wyu.blogrest.repository;

import cn.wyu.blogrest.entity.Status;
import cn.wyu.blogrest.entity.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
import java.util.Set;

public interface StatusRepository extends CrudRepository<Status,Integer>{
    List<Status> findByOrderByCreateTimeDesc();
    List<Status> findByUserOrderByCreateTimeDesc(User user);

    Status findById(int statusId);

    @Query("select s from Status s where s.user in (?1) order by s.createTime desc")

    /*TODO 这个是干嘛的？*/
    List<Status> findFrendsAndMyStatus(Set<User> users);
}
